<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsSkusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_skus', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('goods_id')->comment("商品id");
            $table->unsignedInteger('goods_specs_id')->comment("商品规格id");
            $table->unsignedInteger('goods_specs_value_id')->comment("商品规格值id");
            $table->double('price', 12, 4)->comment("现价");
            $table->double('cost_price', 12, 4)->comment("原价");
            $table->tinyInteger("stock")->default(0)->comment("库存");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_skus');
    }
}
